body {
  background-color: white;
}

.wrapper {
  font: normal 100%/1.5 'Helvetica', 'Arial', 'sans-serif';
  @include margin(24, (left, right));
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  height: 453px; // 473px - 20px bottom spacing
}

.wrapper.square {
  height: 652px; // 700px - (24px * 2)
}

.square {
  .grid {
    width: 630px;
    left: 35px;
    top: 80px;

    // reduce race labels area to 130px instead of 150 px
    grid-template-columns: [race-labels-start] 130px [race-labels-end case-bars-start] 238px [case-bars-end death-bars-start] 262px [death-bars-end];

    &.cases-only {
      grid-template-columns: [race-labels-start] 130px [race-labels-end case-bars-start] 1fr [death-bars-end case-bars-end death-bars-start];
    }

    &.deaths-only {
      grid-template-columns: [race-labels-start] 130px [race-labels-end case-bars-start] 1fr [death-bars-end case-bars-end death-bars-start];
    }

    .deaths-header {
      @include margin(24, left);
    }
  }
}

.header {
  font-size: 18px; // ignore-style-rule
  text-align: center;
  line-height: 150%;

  margin-right: 90px; // ignore-style-rule
  margin-left: 90px; // ignore-style-rule
}

.square {
  .header {
    margin-right: 45px; // ignore-style-rule
    margin-left: 45px; // ignore-style-rule
  }
  .grid {
    @include margin(0, left);
  }
}

.grid {
  display: grid;
  align-self: flex-start;
  @include margin(16, left);
  width: 675px;

  grid-template-rows: auto;
  grid-template-columns: [race-labels-start] 150px [race-labels-end case-bars-start] 240px [case-bars-end death-bars-start] 285px [death-bars-end];
  column-gap: 10px;

  &.cases-only {
    grid-template-columns: [race-labels-start] 150px [race-labels-end case-bars-start] 1fr [death-bars-end case-bars-end death-bars-start];
    .cases-header {
      grid-area: 2 / case-bars-start / 3 / death-bars-end;
    }
  }

  &.deaths-only {
    grid-template-columns: [race-labels-start] 150px [race-labels-end case-bars-start] 1fr [death-bars-end case-bars-end death-bars-start];
    .deaths-header {
      grid-area: 2 / case-bars-start / 3 / case-bars-end;
      @include margin(0, left);
    }
    .death-bar-spacer {
      width: 0px;
    }
  }

  .bar-header {
    font-weight: bold;
    @include margin(0, top);
    margin-bottom: 5px; // ignore-style-rule
  }

  .cases-header {
    grid-area: 2 / case-bars-start / 3 / case-bars-end;
  }

  .deaths-header {
    grid-area: 2 / death-bars-start / 3 / death-bars-end;
    margin-left: 45px; // ignore-style-rule
  }

  .cases-header,
  .deaths-header {
    justify-self: start;
    align-self: end;
    font-size: 14px; // ignore-style-rule
  }

  .bar-label {
    justify-self: right;
    align-self: center;
    text-align: right;
    margin-left: spacer(16); // forces the category titles to wrap

    font-size: 14px; // ignore-style-rule
    line-height: 1.15;
  }
}

.square {
  .bar-label {
    margin-left: 0;
  }
}

.footer {
  color: $color-slate-700;
  font-size: 14px; // ignore-style-rule
  line-height: 1.2;

  display: flex;
  align-items: flex-end;
  @include margin(16, left); // matches grid
  justify-content: space-between;

  .notes {
    margin-top: 13px; // ignore-style-rule
    width: 730px;
  }
}

.national {
  font-size: 13px; // ignore-style-rule
}

.asterisk-footnote {
  @include margin(8, top);
}

.square {
  .footer {
    .notes {
      width: 525px;
    }
  }
}

.logos-container {
  display: flex;
  flex-direction: column;
  @include padding(8, left);

  .ctp-logo {
    width: 108px;
  }

  .car-logo {
    width: 68px;
    margin-left: 20px; // ignore-style-rule
    @include margin(16, bottom);
  }
}

.bar-container {
  display: flex;
  font-size: 14px; // ignore-style-rule
  line-height: 1;
  align-items: flex-start;

  span {
    align-self: center;
    margin-left: 5px; // ignore-style-rule
  }
}

.bar {
  height: 25px;
  width: 0px;
  font-size: 14px; // ignore-style-rule
  text-align: right;
  margin-top: 6px; // ignore-style-rule
  margin-bottom: 6px; // ignore-style-rule

  display: flex;
  justify-content: flex-end;
  align-items: center;

  span {
    line-height: 1.25;
  }

  &.has-inner-label {
    padding-right: 10px; // ignore-style-rule
  }

  &.barBlack {
    background: $qualitative-color-palette-300;
  }
  &.barLatinx {
    background: $qualitative-color-palette-400;
  }
  &.barAll {
    background: $color-slate-400;
  }
  &.barAsian {
    background: $color-plum-800;
    color: white;
  }
  &.barAian {
    background: $qualitative-color-palette-600;
    color: white;
  }
  &.barWhite {
    background: $qualitative-color-palette-200;
  }
  &.barNhpi {
    background: $qualitative-color-palette-500;
    color: white;
  }
  &.barAPi {
    background: $color-plum-800;
    color: white;
  }
}

.death-bar-spacer {
  width: 45px;
}

.insufficient-data {
  font-size: 14px;
  line-height: 1;
  align-self: center;
  color: $color-slate-600;

  &.insufficient-data-deaths {
    margin-left: 45px; // ignore-style-rule
  }
}

.square {
  .bar {
    height: 35px;
  }
  .death-bar-spacer {
    width: 24px;
  }
  .insufficient-data.insufficient-data-deaths {
    margin-left: 24px; // ignore-style-rule
  }
}

.no-data-container {
  display: flex;
  justify-content: center;
  flex-direction: column;
  @include type-size(300);
  padding: 116px 180px; // ignore-style-rule

  .logos-container {
    flex-direction: row-reverse;
    @include margin(16, top);
    justify-content: center;

    .ctp-logo {
      margin-right: 6px; // ignore-style-rule
    }

    .car-logo {
      @include margin(16, right);
      @include margin(0, bottom);
    }
  }

  &.square {
    padding: 170px 60px; // ignore-style-rule

    .alert {
      width: 90px;
      @include margin(8, bottom);
    }

    p {
      @include margin(16, (top, bottom));
      @include margin(0, (left, right));
    }

    .get-better-data {
      min-width: 500px;
    }
  }

  .alert {
    width: 60px;
    margin: 0 auto; // ignore-style-rule
  }

  p {
    text-align: center;
    @include margin(8);
  }

  .get-better-data {
    background-color: $color-plum-100;
    padding: 1rem 1.5rem; // ignore-style-rule
  }
}
